<?php
namespace Weiping\Controller;
use Think\Controller;
use Weixin\Api\WebpageApi;
class IndexController extends BaseController {
	

    public function index(){
    	
    	
    	
    	$data=M("company")->select();
    	$this->assign("company",$data);
    	$this->display('index2');
    }
    
    public function questionnaire(){
    	
    	
    	$id=I("get.id");
    	$data=M("questionnaires")->where("ispub=1 and type='".$id."'")->select();
    	$this->assign("questionnaire",$data);
    	$this->display();
    }
    
	public function coupon(){
    	
    	
		$model=new \Think\Model;

        $replyRecords = $model->table("wpsk_coupon c,wpsk_company q")->where("c.company_id=q.id and c.openid='".$_SESSION['openid']."'")
        				->field('c.*,q.name')->select();
        
    	$this->assign("coupon",$replyRecords);
    	$this->display();
    }
}